<?php
session_start();
if(@$_SESSION['userName']==''){
	echo "非访访问";
	echo "<script> window.location.href='login.php'; </script>";
}
require_once 'conn/conn.class.php';
$myDb=new conn('127.0.0.1','root','root','phplogin');
$sql="select * from tb_register where user='".$_SESSION['userName']."' and password='".$_SESSION['PSW']."'";
if(is_array($arr=$myDb->get_row_array($sql))){
	if($arr[10]=='0'){
		echo "账号未激活，请激活！";
		echo "<a href=''></a>";
		exit();
	}else{
		echo "你好，欢迎".$_SESSION['userName'];
		echo "<br/>";
		echo "<a href='main.php?action=lgo'>退出登入</a>";
	}
}

if(@$_GET['action']=='lgo'){
	session_destroy();
	echo "退出登入成功";
	echo "<script> window.location.href='login.php'; </script>";
}